<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-lx-cascades"></i> 基础表格
                </el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="handle-box">
                <el-input v-model="query.eposition" placeholder="岗位名" class="handle-input mr10"></el-input>
                <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
            </div>
        <div class="container">
            <el-table
                :data="Posts1Data"
                border
                class="table"
                ref="multipleTable"
                header-cell-class-name="table-header"
                :@selection-change="handleSelectionChange"
            >
                <el-table-column type="selection" width="55" align="center"></el-table-column>
                <el-table-column prop="Eid" label="员工编号" width="55" align="center"></el-table-column>
                <el-table-column prop="Ename" label="姓名"></el-table-column>
                <el-table-column prop="Egender" label="性别"></el-table-column>
                <el-table-column prop="Eidcard" label="身份证号"></el-table-column>
				<el-table-column prop="Ephone" label="电话"></el-table-column>
                <el-table-column prop="Ebirth" label="出生日期"></el-table-column>
                <el-table-column prop="Edepartment" label="部门"></el-table-column>
                <el-table-column prop="Eposition" label="岗位"></el-table-column>
                <el-table-column prop="Edate" label="入职日期"></el-table-column>
                <el-table-column prop="Esource" label="人员来源"></el-table-column>
                <el-table-column prop="Edegree" label="最高学历"></el-table-column>
                <el-table-column label="其它" width="180" align="center">
                    <template >
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>

<script>
import {fetchPosts1Data,searchPosts1} from '../../api/index';
export default {
    name: 'basetable',
    data() {
        return {
            query: {},
            Posts1Data: [],
            multipleSelection: [],
            delList: [],
            editVisible: false,
            pageTotal: 0,
            form: {},
            idx: -1,
            id: -1
        };
    },
    created() {
        this.getPosts1Data();
    },
    methods: {
        getPosts1Data() {
             fetchPosts1Data(this.query).then(res => {
                console.log(res);
                this.Posts1Data = res.data.value;
                this.pageTotal = res.pageTotal || 50;
            });
        },
        handleSearch() {
                      console.info(this.query)
                      searchPosts1(this.query).then(res => {
                          console.info(res)
                          if(res.code == 30001)
                          {
                          this.getPosts1Data();
                          }
                          else{
                          this.Posts1Data = res.data.value
                          }

                      })
                  }
          }
}

</script>

<style scoped>
.handle-box {
    margin-bottom: 20px;
}

.handle-select {
    width: 120px;
}

.handle-input {
    width: 300px;
    display: inline-block;
}
.table {
    width: 100%;
    font-size: 14px;
}
.red {
    color: #ff0000;
}
.mr10 {
    margin-right: 10px;
}
.table-td-thumb {
    display: block;
    margin: auto;
    width: 40px;
    height: 40px;
}
</style>
